home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / ES 1.2 Package.sit / ES 1.2 Package / Developer’s toolkit / Headers / ExtensionsStrip.p < prev    next >
Text File  |  1995-12-09  |  16KB  |  381 lines

  1. {
  2.      File:        ExtensionsStrip.p
  3.  
  4.      Contains:    Extensions Strip Specific Interfaces for Control Strip modules.
  5.  
  6.      Version:    Technology:    System 7.1+ (System 7.5+ preferred)
  7.                  Package:    Extensions Strip 1.2
  8.  
  9.      Copyright:    ゥ 1995 by Ammon Skidmore, Skidperfect Software Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem, have a criticism or comment with this
  13.                  file, please inform the author at the following address:
  14.                      Internet:    skidperfect@kagi.com
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT ExtensionsStrip;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __EXTENSIONSSTRIP__}
  27. {$SETC __EXTENSIONSSTRIP__ := 1}
  28.  
  29. {$I+}
  30. {$SETC ExtensionsStripIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __CONTROLSTRIP__}
  35. {$I ControlStrip.p}
  36. {$ENDC}
  37.  
  38. {$IFC UNDEFINED __APPLEEVENTS__}
  39. {$I AppleEvents.p}
  40. {$ENDC}
  41.  
  42.  
  43. {$PUSH}
  44. {$ALIGN MAC68K}
  45. {$LibExport+}
  46.  
  47. {******************************************************************************************
  48.  
  49.     Special Extensions Strip selector calls to modules.
  50.  
  51. ******************************************************************************************}
  52. CONST
  53.     sdevInAppContext            = 2000;    {   called only once after the module specifically        }
  54.                                         {   requested to be executed from inside Extension        }
  55.                                         {   Strip's context. NB: you can return the special        }
  56.                                         {   result values.                                        }
  57.                                         {}
  58.     sdevInterceptedEvent        = 2001;    {    if the module returned the sdevInterceptAllEvents    }
  59.                                         {   flag in its features, then this selector            }
  60.                                         {   will get called before _each_ event is processed    }
  61.                                         {   by Extensions Strip.  Meant to be used with            }
  62.                                         {   _SBGetCurrentEvent so each event can be looked at,    }
  63.                                         {   and modified if necessary (to prevent passing.)        }
  64.                                         {   NB: you can return the special result values.        }
  65.                                         {}
  66.     sdevDragAccept                = 2002;    {    return 0 if you accept the current drag, and        }
  67.                                         {   1 if you do not.  Modules that do not have any        }
  68.                                         {   drag handlers will never get this called.            }
  69.                                         {   NB: sdevDragAccept is only called from within        }
  70.                                         {   Extensions Strip's dragTrackingInWindow.  So it        }
  71.                                         {   is recommended to only check if you accept the drag    }
  72.                                         {   from within your dragTrackingEnterWindow, and then    }
  73.                                         {   set a global var that you can pass onto ES.            }
  74.                                         {}
  75.     sdevEventMask                = 2003;    {    if the module returned the sdevInterceptAllEvents    }
  76.                                         {   flag in its features, this selector will get        }
  77.                                         {   called to find the event mask to use.  Return your    }
  78.                                         {   mask as the result value of the sdev call.            }
  79.                                         {   sdevEventMask is called once upon initialization,    }
  80.                                         {   and every time sdevFeaturesChange is requested.        }
  81.  
  82.  
  83. {******************************************************************************************
  84.  
  85.     Features supported by the module.  If a bit is set, it means that feature is supported.
  86.  
  87.     Tip: if you clear sdevWantMouseClicks and set sdevDontAutoTrack, your module
  88.     will receive clicks and Extensions Strip (plus Desktop Strip) will not
  89.     auto-hilite your module.
  90.  
  91. ******************************************************************************************}
  92.     sdevHasDragHandlers            = 31;    {    module has installed a drag tracking and/or            }
  93.                                         {   receive handler in the Strip window.                }
  94.                                         {}
  95.     sdevDontPeriodicTickle        = 30;    {    module does not require any idle time so            }
  96.                                         {   by setting this bit it will never get                }
  97.                                         {   called with the sdevPeriodicTickle                     }
  98.                                         {   selector.  Note that you can set this along            }
  99.                                         {   with the sdevInterceptAllEvents bit (if you want)    }
  100.                                         {   and sdevInterceptedEvent will still get called.        }
  101.                                         {   So be nice and set this to help speed up idle        }
  102.                                         {   time processing.                                    }
  103.                                         {}
  104.     sdevInterceptAllEvents        = 29;    {    module wants to be executed before each                }
  105.                                         {   event passes through Extension Strip's                }
  106.                                         {   jGNE filter.  Because the module is allowed            }
  107.                                         {   to modify every event, there is no more need        }
  108.                                         {   for modules, such as Terminator Strip, to            }
  109.                                         {   install their own jGNE filters!                        }
  110.                                         {   NB: You need to return an event mask when your        }
  111.                                         {   module is called by the sdevEventMask selector.        }
  112.  
  113.  
  114. {******************************************************************************************
  115.  
  116.     Special result values returned by the sdevPeriodicTickle and sdevMouseClick selectors.
  117.     If a bit is set, the module can request that a specific function is performed by
  118.     the Control Strip.  All undefined bits should be set to zero.
  119.  
  120.     Note: these values can also be returned by the sdevInAppContext and
  121.     sdevInterceptedEvent selectors.
  122.  
  123. ******************************************************************************************}
  124.     sdevQueueModule                = 31;    {    module needs to be executed from within                }
  125.                                         {   Extension Strip's context: useful for                }
  126.                                         {   things like sending AppleEvents or                    }
  127.                                         {   creating and tracking new drags.                    }
  128.                                         {}
  129.     sdevFeaturesChange            = 30;    {    module wants to change its feature flags. Useful    }
  130.                                         {   for changing clickable state of the module and        }
  131.                                         {   for locking/unlocking the sdev code.                }
  132.  
  133. {******************************************************************************************
  134.  
  135.     miscellaneous
  136.  
  137. ******************************************************************************************}
  138.     kModuleFolderType                = 'sdev';    { FindFolder type for the root folder        }
  139.     kModuleDisabledFolderType        = 'sdeD';    { FindFolder type for the disabled            }
  140.                                                 { root folder (place to put inactive        }
  141.                                                 { modules that you don't want deleted.)        }
  142.     sdevTypeCodePPC                    = 'Sdev';    { resource type for module's PPC code        }
  143.  
  144.     gestaltExtensionsStripAttr        = 'CsEs';    {returns Extensions Strip's attributes.        }
  145.     { currently returned bits from gestaltExtensionsStripAttr: }
  146.     gestaltExtensionsStripExists    = 0;        {Extensions Strip is currently launched        }
  147.     gestaltSupportsFontTraps        = 1;        { The new font traps of Control Strip 1.2    }
  148.                                                 { are supported.  ES 1.0 incorrectly gave    }
  149.                                                 { Control Strip's font trap gestalt bit.    }
  150.     gestaltHasSBResolveAliasFile    = 2;        { ES contains the new alias resolving trap.    }
  151.                                                 { This bit also signifies that ES can only    }
  152.                                                 { be run as a regular application.            }
  153.  
  154.     gestaltDesktopStripAttr            = 'CsWT';    { returns the Desktop Strip program            }
  155.                                                 { attributes which are supported by            }
  156.                                                 { Extensions Strip.  See Desktop Strip's    }
  157.                                                 { docs for details about the bits            }
  158.  
  159. TYPE
  160.     ModuleReference = LONGINT;
  161.  
  162.  
  163.     SBQueueProcPtr = ProcPtr;  { PROCEDURE SBQueue(refCon: LONGINT); }
  164.     SBQueueUPP = UniversalProcPtr;
  165.  
  166. CONST
  167.     uppQueueProcProcInfo =  $000000C0; { PROCEDURE (4 byte param); }
  168.  
  169. FUNCTION NewSBQueueProcProc(userRoutine: SBQueueProcPtr): SBQueueUPP;
  170.     {$IFC NOT GENERATINGCFM }
  171.     INLINE $2E9F;
  172.     {$ENDC}
  173.  
  174. {******************************************************************************************
  175.  
  176.     Control Strip trap calls
  177.  
  178. ******************************************************************************************}
  179.  
  180. {                                                                                 }
  181. { All routines are documented as to whether the Extensions Strip implementation  }
  182. { of them they may move memory.  You can trust that a routine that says it         }
  183. { will not move memory in this version, will not move memory in future versions. }
  184. { Note though, that some Universal Control Strip traps may move memory under     }
  185. { Control/Desktop Strip but not in Extensions Strip (such as                     }
  186. { _SBIsControlStripVisible and _SBShowHideControlStrip.)                         }
  187. {                                                                                 }
  188.  
  189. { ===================================================== }
  190. { =========== Universal Control Strip traps =========== }
  191. { ===================================================== }
  192. {
  193. 'Yes' = May move memory!
  194. 'No'  = Will not move memory.
  195. 'unimplemented'    = Trap not supported by Extensions Strip when this header file
  196.                 was released.  Check the Control Strip gestalt features to
  197.                 determine if/when Extensions Strip supports these traps.
  198.  
  199. SBIsControlStripVisible        no
  200. SBShowHideControlStrip        no
  201. SBSafeToAccessStartupDisk    no
  202. SBOpenModuleResourceFile    yes
  203. SBLoadPreferences            yes
  204. SBSavePreferences            yes
  205. SBGetDetachedIndString        no
  206. SBGetDetachIconSuite        yes
  207. SBTrackPopupMenu            yes
  208. SBTrackSlider                yes
  209. SBShowHelpString            yes
  210. SBGetBarGraphWidth            no
  211. SBDrawBarGraph                yes
  212. SBModalDialogInContext        yes
  213.  
  214. Control Strip 1.2 and later
  215. ---------------------------
  216. SBGetControlStripFontID        no
  217. SBSetControlStripFontID        no
  218. SBGetControlStripFontSize    no
  219. SBSetControlStripFontSize    no
  220. SBGetShowHideHotKey            unimplemented
  221. SBSetShowHideHotKey            unimplemented
  222. SBIsShowHideHotKeyEnabled    unimplemented
  223. SBEnableShowHideHotKey        unimplemented
  224. }
  225.  
  226. { ===================================================== }
  227. { ========== Extensions Strip specific traps ========== }
  228. { ===================================================== }
  229.  
  230. { Strip Window Utilities }
  231.  
  232.     { returns: true = vertical; false = horizontal }
  233.     {}        { Will not move memory. }
  234. FUNCTION SBIsControlStripVertical(stripPort: WindowRef): BOOLEAN;
  235.     {$IFC NOT GENERATINGCFM}
  236.     INLINE $70FF, $AAF2;
  237.     {$ENDC}
  238.  
  239.     { returns pixel depth of the monitor this Strip window is in (always a power of 2) }
  240.     {}        { Will not move memory. }
  241. FUNCTION SBGetControlStripDepth(stripPort: WindowRef): INTEGER;
  242.     {$IFC NOT GENERATINGCFM}
  243.     INLINE $70FE, $AAF2;
  244.     {$ENDC}
  245.  
  246.     { returns the current normal back color of this Strip window }
  247.     {}        { Will not move memory. }
  248. PROCEDURE SBGetStripBackColor(VAR color: RGBColor; stripPort: WindowRef);
  249.     {$IFC NOT GENERATINGCFM}
  250.     INLINE $70FD, $AAF2;
  251.     {$ENDC}
  252.  
  253.     { returns the current back color of this Strip window when a module is selected }
  254.     {}        { Will not move memory. }
  255. PROCEDURE SBGetStripSelectedColor(VAR color: RGBColor; stripPort: WindowRef);
  256.     {$IFC NOT GENERATINGCFM}
  257.     INLINE $70FC, $AAF2;
  258.     {$ENDC}
  259.  
  260. { Module Utilities }
  261.  
  262.     { returns a reference number that all of the Module Utilities need                }
  263.         { NB: since SBGetMyReferenceNum can ONLY be called from sdevInitModule,        }
  264.         {   you should save its value into your globals if you are going to use        }
  265.         {   one of the Module Utilities later, such as inside a tracking handler.    }
  266.     { Also, the reference number will always be non-zero. }
  267.     {}        { Will not move memory. }
  268. FUNCTION SBGetMyReferenceNum: ModuleReference;
  269.     {$IFC NOT GENERATINGCFM}
  270.     INLINE $70FB, $AAF2;
  271.     {$ENDC}
  272.  
  273.     { total window space taken up by a module.  Useful for drag-n-drop calculations }
  274.     { note that this rect will always be larger than the module's statusRect. }
  275.     {}        { Will not move memory. }
  276. PROCEDURE SBGetTotalModuleBounds(VAR bounds: Rect; stripPort: WindowRef; moduleRefNum: ModuleReference);
  277.     {$IFC NOT GENERATINGCFM}
  278.     INLINE $70FA, $AAF2;
  279.     {$ENDC}
  280.  
  281.     { returns the statusRect of the module.  Very useful for drag-n-drop routines }
  282.     { because you no longer have to constantly set a global rectangle variable to }
  283.     { hold the current location of the module in the Strip window. }
  284.     {}        { Will not move memory. }
  285. PROCEDURE SBGetModuleBounds(VAR bounds: Rect; moduleRefNum: ModuleReference);
  286.     {$IFC NOT GENERATINGCFM}
  287.     INLINE $70F9, $AAF2;
  288.     {$ENDC}
  289.  
  290. { Miscellaneous Utilities }
  291.  
  292.     { runs this (locked!) piece of code once within Extensions Strip's context.        }
  293.     { PPC modules must pass a valid routine descriptor to this function.  Since        }
  294.     { the descriptor will not be disposed of after the code has executed, I would    }
  295.     { recommend creating the descriptor (NewSBQueueProcProc) when sdevInitModule    }
  296.     { is called and disposing it upon sdevCloseModule.                                }
  297.     { A non-zero result code means that the UPP could not be queued (memory error).    }
  298.     {}        { May move memory! }
  299. FUNCTION SBQueueCode(theProc: SBQueueUPP; refCon: LONGINT): OSErr;
  300.     {$IFC NOT GENERATINGCFM}
  301.     INLINE $70F8, $AAF2;
  302.     {$ENDC}
  303.  
  304.     { sends the specified Apple Event within Extensions Strip's context to insure        }
  305.     { safe sending rather than trusting that the front application is AE aware.            }
  306.     { _SBSimpleAESend acts just like _AESend in that the AppleEvent you give to it        }
  307.     { must still be disposed of afterward by your code to free up memory (even            }
  308.     { though the event hasn't actually been sent yet.)                                    }
  309.     {}
  310.     { _SBSimpleAESend is meant to be an easy way to send simple events.  If you            }
  311.     { need to check the reply AppleEvent or the _AESend error, ect., you should queue    }
  312.     { your code (with _SBQueueCode or by having your module return 'sdevQueueModule')    }
  313.     { and send the Apple Event yourself.  The result returned by _SBSimpleAESend        }
  314.     { is only non-zero if an error occured while queueing the event for later sending.    }
  315.     {}
  316.     { Also, if an error does occur when Extensions Strip sends your AppleEvent, the        }
  317.     { user will be notified with a dialog that _AESend failed.                            }
  318.     {}
  319.     { Here are the parameters I give to _AESend.  They are basic enough for most        }
  320.     { kinds of Apple Events that modules send, hence the name _SBSimpleAESend.            }
  321.     { err := AESend(theAppleEvent, reply,                 your specified AppleEvent        }
  322.     {                                                    { and a dummy reply descriptor    }
  323.     {            kAENoReply + kAEAlwaysInteract + kAECanSwitchLayer,     send mode        }
  324.     {            kAENormalPriority,                                     send priority    }
  325.     {            kAEDefaultTimeout,                                     time out            }
  326.     {            nil,                                                 idleProc            
  327.     {            nil);                                                 filterProc        
  328.     {}        { May move memory! }
  329. FUNCTION SBSimpleAESend({CONST}VAR theAppleEvent: AppleEvent): OSErr;
  330.     {$IFC NOT GENERATINGCFM}
  331.     INLINE $70F7, $AAF2;
  332.     {$ENDC}
  333.  
  334.  
  335.     { returns a pointer to the current event being processed.  Modififations to        }
  336.     { the data in this pointer WILL take effect as the event gets passed along        }
  337.     { to the other processes and jGNE filters further on in the chain.  Although    }
  338.     { a module can use this function at any time, it is really meant to be called    }
  339.     { within the sdevInterceptedEvent selector because this is where a module can    }
  340.     { deny other modules the proper processing of the event (such as in the case    }
  341.     { of a keyDown.)  Another good use for SBGetCurrentEvent() is to find the exact    }
  342.     { point where a mouseDown occured if you have a queue of clickable objects.        }
  343.     {}        { Will not move memory. }
  344. TYPE
  345.     EventRecordPtr = ^EventRecord;
  346. FUNCTION SBGetCurrentEvent: EventRecordPtr;
  347.     {$IFC NOT GENERATINGCFM}
  348.     INLINE $70F6, $AAF2;
  349.     {$ENDC}
  350.  
  351.     { For Extensions Strip 1.2 and later.                                    }
  352.     { Check for gestalt features bit 'gestaltHasSBResolveAliasFile'.        }
  353.  
  354.     { resolves a chain of alias files just like the toolbox routine ResolveAliasFile()    }
  355.     { but with an option to override the mounting of remote volumes.  Most of the code    }
  356.     { is from an Apple snippet in the Technote "Quietly Resolving Finder Aliases".        }
  357.     {}
  358.     { Also, in the event of the display of an AppleShare mounting dialog, if the        }
  359.     { current process is not in front, then the front process will be set to the        }
  360.     { current one.  Since Extensions Strip 1.2 and later can only be run as regular        }
  361.     { applications, the use of this trap is almost always safe to display mount            }
  362.     { dialogs.  You should, however, set the mounting of remote volumes to false        }
  363.     { if called inside a drop handler when the current process is not the front one.    }
  364.     {}        { May move memory! }
  365. FUNCTION SBResolveAliasFileMountOption(VAR fileFSSpec: FSSpec; resolveAliasChains: Boolean; VAR targetIsFolder: Boolean; VAR wasAliased: Boolean; mountRemoteVols: Boolean): OSErr;
  366.     {$IFC NOT GENERATINGCFM}
  367.     INLINE $70F5, $AAF2;
  368.     {$ENDC}
  369.  
  370.  
  371. {$ALIGN RESET}
  372. {$POP}
  373.  
  374. {$SETC UsingIncludes := ExtensionsStripIncludes}
  375.  
  376. {$ENDC} {__EXTENSIONSSTRIP__}
  377.  
  378. {$IFC NOT UsingIncludes}
  379.  END.
  380. {$ENDC}
  381.